]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionSystem: Fix extension enabling/disabling order
authorKyrill Zorin <zorink@zoringroup.com>
Mon, 11 Aug 2025 22:42:36 +0000 (23:42 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 13 Sep 2025 16:57:40 +0000 (18:57 +0200)
Move disabling of unneeded extensions before enabling new ones
in _onEnabledExtensionsChanged(). Previously, conflicting
extensions could simultaneously be active briefly, leading to
unclean states, memory leaks, freezes, or crashes.

The old logic also caused unnecessary disable/enable cycles
for newly requested extensions, wasting resources. Running
the disable step first prevents these issues.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3835>
(cherry picked from commit d3390d1afecbc7829b1618b99995f48eddb90f4a)

js/ui/extensionSystem.js

index 911490ac9a097d2cfb1e10dcc5a3b131b8d493c1..4c4575f6cee5393d9f3c8b9a34ae73941d791f22 100644 (file)
@@ -571,16 +571,6 @@ export class ExtensionManager extends Signals.EventEmitter {
                 this.emit('extension-state-changed', extension);
         }
 
-        // Find and enable all the newly enabled extensions: UUIDs found in the
-        // new setting, but not in the old one.
-        const extensionsToEnable = newEnabledExtensions
-            .filter(uuid => !this._enabledExtensions.includes(uuid) &&
-                             this._extensionSupportsSessionMode(uuid));
-        for (const uuid of extensionsToEnable) {
-            // eslint-disable-next-line no-await-in-loop
-            await this._callExtensionEnable(uuid);
-        }
-
         // Find and disable all the newly disabled extensions: UUIDs found in the
         // old setting, but not in the new one.
         const extensionsToDisable = this._extensionOrder
@@ -594,6 +584,16 @@ export class ExtensionManager extends Signals.EventEmitter {
             await this._callExtensionDisable(uuid);
         }
 
+        // Find and enable all the newly enabled extensions: UUIDs found in the
+        // new setting, but not in the old one.
+        const extensionsToEnable = newEnabledExtensions
+            .filter(uuid => !this._enabledExtensions.includes(uuid) &&
+                             this._extensionSupportsSessionMode(uuid));
+        for (const uuid of extensionsToEnable) {
+            // eslint-disable-next-line no-await-in-loop
+            await this._callExtensionEnable(uuid);
+        }
+
         this._enabledExtensions = newEnabledExtensions;
     }